import { produce } from 'immer';

const baseState = {
  users: [{
    name: 'John',
    age: 20,
  }, {
    name: 'Jane',
    age: 21,
  }],
  posts: [{
    title: 'Hello World',
    content: 'This is a test post',
    author: 'John',
  }, {
    title: 'Hello World 2',
    content: 'This is a test post 2',
    author: 'Jane',
  }],
}

const nextState = produce(baseState, (draft) => {

  draft.posts.push({
    title: 'Hello World 3',
    content: 'This is a test post 3',
    author: 'John',
  });
});
console.log(nextState.posts === baseState.posts);
console.log(nextState.posts[0] === baseState.posts[0]);
console.log(nextState.users === baseState.users);
